home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-25 | 5.0 KB | 243 lines | [TEXT/sLiN] |
- !
- ! LineShare™ Script for ZyXEL U-1496 modems
- !
- ! This script is designed to use with the TeleFinder™ BBS.
- !
- ! For some reasons TeleFinder redefines the LineFeed character (S4)
- ! We don't redefine it really, but we emulate modem responses with that symbol
- ! This trick is done with the lines marked with '$$$$'
- !
- ! If you want to modify this script for your modem, pay attention to
- ! the line marked "#### Settings ####" - it should be modified first
- !
- ! The TeleFinder "Host Options" used:
- ! "Adjust BPS to line speed" - *disabled*
- ! "Use Break Reset" - *enabled*,
- !
-
- ! ------------------------------------------
- ! Resetting the modem:
- ! ------------------------------------------
- @Hangup
- SetTries 2
- Flush
- HsReset 0,0,17,19,0,0
- !
- ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
- ! to enter the command mode
- !
- @Label 1
- matchclr
- matchstr 1 2 "OK\r\n"
- write "ATH0&F\r"
- matchread 20
- Write "+++"
- DtrClear
- pause 10
- DtrSet
- !
- DecTries
- IfTries 0 1
- !
- ! OSErr -6019 "Modem error - the modem is not responding"
- !
- exit -6019
- @Label 2
- write "AT+FCLASS=0\r"
- Jsr 100
- write "AT+FAA=0\r"
- Jsr 100
- exit 0
- ! ------------------------------------------
- ! Receiving incoming calls
- ! ------------------------------------------
- @ANSWER
- @Label 10
- !
- ! Set the modem preferred speed first
- !
- SERRESET 2400,0,8,1
- Jsr 80
- !
- ! Set the common options
- Jsr 70
- !
- ! Set the communication options:
- ! Extended response set
- ! • &K4 - Enable MNP/V42 connections (for TeleFinder)
- ! • &H4 - Xon/Xoff flow control (for Fax)
- ! Fax mode (to enable fax tuning commands)
- !
- @Label 11
- ! #### Settings ####
- Write "ATX4&K4&H4+FCLASS=2\r"
- Jsr 100
- !
- ! Set the "work" speed
- !
- @Label 12
- SERRESET 19200,0,8,1
- Jsr 80
- !
- ! Set Fax parameters: LID, DCC,BOR
- !
- Write "AT+FLID=\"Stalker_GmbH\"\r"
- Jsr 100
- Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
- Jsr 100
- Write "AT+FBOR=1\r"
- Jsr 100
- !
- ! Allow modem to receive fax messages
- !
- Write "AT+FCR=1\r"
- Jsr 100
- !
- ! Tell the modem to determine the type of the incoming call
- ! Fetch the tube after N rings, where N has been set in the control panel (^4)
- !
- Write "ATS0=^4+FAA=1\r"
- Jsr 100
- !
- ! Everything is ready - let's sit and wait for a call
- ! We'll wait for 2 minutes, then reinitiate the modem
- @Label 20
- MatchClr
- matchstr 1 20 "RING\r"
- matchstr 2 21 "CONNECT"
- matchstr 13 30 "+FCON"
- matchstr 14 10 "\r\nNO "
- matchstr 15 10 "BUSY"
- Matchread 1200
- jump 10
- !
- ! Data connection has been established (we read "CONNECT")
- ! Remove everything till "\r\n" from the buffer
- ! Emulate the CONNECT 2400 message (with modified LineFeed chars)
- ! Attach the "TF" subPort
- !
- @Label 21
- MatchClr
- MatchStr 1 22 "\r\n"
- MatchRead 10
- exit -6019
- @Label 22
- QueueInput "\r\27CONNECT 2400\r\27"
- Attach "TF" (DTR,BREAK,ESCAPE,IDLELIMIT=60)
- !
- ! Fax connection has been established (we read "+FCON")
- ! Put the +FCON back to the buffer,
- ! Put the "RING" before the "+FCON"
- ! Attach the "Fax" subPort
- !
- @Label 30
- QueueInput "\r\nRING\r\n\r\n+FCON"
- Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
- ! ------------------------------------------
- ! Originating a call through the "Fax" subPort
- ! ------------------------------------------
- @ORIGINATE "Fax"
- !
- ! Set the preffered speed
- !
- ! SERRESET 2400,0,8,1
- ! Jsr 80
- !
- ! Set the common options
- !
- ! Jsr 70
- !
- ! Set the "Data" speed
- !
- SERRESET 19200,0,8,1
- Jsr 80
- !
- ! Set the Fax mode
- !
- Write "AT+FCLASS=2\r"
- Jsr 100
- !
- ! Now emit all commands that the application has sent to that port,
- ! Prepare to receive all error result codes
- !
- !EmitClear "S","S","S","&","&","\\","\\"
- Jsr 60
- !
- ! Prepare to connect
- !
- Jsr 90
- MatchStr 1 51 "\r\n+FCON"
- HsReset *
- Write "ATD^1\r"
- MatchRead 700
- Write "\r"
- Exit -6019
- @LABEL 51
- QueueInput "\r\n+FCON"
- Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
- !
- ! This section emits all modem commands sent by the client application
- ! For each set of commands the "OK" answer is awaited
- !
- @Label 60
- EmitStart
- @Label 61
- EmitCommand 62
- Jsr 100
- Jump 61
- @Label 62
- return
- !
- ! This section initiates the modem before ANSWER and ORIGINATEs:
- ! factory settings + speaker control +
- ! reset on Dtr drop + DCD valid
- ! Verbal responses mode, no echo
- ! Set &S1 (DSR) in case the cable connects the DSR signal with the CTS pin
- !
- @Label 70
- Write "ATM^2L^3&D2&C1V1E0\r"
- Jsr 100
- return
- !
- ! This section syncronize the modem after the serial port speed switching
- !
- @Label 80
- ChrDelay 1
- Write "AT\r"
- ChrDelay 0
- Jsr 100
- return
- !
- ! Prepare to receive error result codes
- !
- @Label 90
- MatchClr
- MatchStr 2 91 "NO DIALTONE\r\n"
- MatchStr 3 92 "BUSY\r\n"
- MatchStr 4 93 "NO CARRIER\r\n"
- MatchStr 5 94 "NO ANSWER\r\n"
- return
- @Label 91
- exit -6020
- @Label 92
- exit -6022
- @Label 93
- exit -6021
- @Label 94
- exit -6023
- !
- ! Processing the AT command:
- ! OK -> proceed
- ! ERROR or TimeOut ->exit -6019
- ! It can be called AFTER the "Write" command, since LineShare buffers input
- !
- @Label 100
- MatchClr
- MatchStr 1 102 "\r\nOK\r\n"
- MatchStr 2 101 "\r\nERROR\r\n"
- MatchRead 20
- @Label 101
- Exit -6019
- @Label 102
- return
-